package com.lsj.core.page;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class QueryPage<T> {
    private Long current;
    private Long size;
    T data;

    //封装成mybatis plus的page类，方便分页查询
    public Page getMpPage(){
        Page mpPage = new Page<>();
        mpPage.setCurrent(this.current!=null&&this.current>0?this.current:1);
        mpPage.setSize(this.size!=null?this.size:10);//如果为-1.即查询全部
        return mpPage;
    }
}
